﻿@model WebUI.Models.Tables.Article
@{
    ViewBag.Title = ViewBag.CurrentTitle + "文章";
}
@section head{
    <link href="~/Areas/Admin/Content/table.css" rel="stylesheet" />
}
@using (Html.BeginForm("Edit", "Article", new { current = 7 }))
{
    @Html.AntiForgeryToken()
    @Html.HiddenFor(m => m.ID)
    @Html.HiddenFor(m => m.CreateDateTime)
    @Html.HiddenFor(m => m.MainImage)
    <table class="admin-table" border="1">
        <thead>
            <tr>
                <td class="name">名称</td>
                <td class="context">内容</td>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td class="name">@Html.DisplayNameFor(m => m.Title)</td>
                <td class="context">@Html.EditorFor(m => m.Title)</td>
            </tr>
            <tr>
                <td class="name">@Html.DisplayNameFor(m => m.CatID)</td>
                <td class="context">@Html.DropDownList("CatID")</td>
            </tr>
            <tr>
                <td class="name">@Html.DisplayNameFor(m => m.Defined)</td>
                <td class="context">@Html.TextAreaFor(m => m.Defined)</td>
            </tr>
            <tr>
                <td class="name">@Html.DisplayNameFor(m => m.MainImage)</td>
                <td class="context">
                    <img id="mainImg" style="width:220px;display:none;" />
                    <button id="filePicker">选择图片</button><span id="percent"></span>
                </td>
            </tr>
            <tr>
                <td class="name">@Html.DisplayNameFor(m => m.Content)</td>
                <td class="context">
                    <!-- 加载编辑器的容器 -->
                    <script id="container" name="Content" type="text/plain" style="width:100%;height:360px;">
                        @Html.Raw(Model.Content)
                    </script>
                </td>
            </tr>
            <tr>
                <td class="name">@Html.DisplayNameFor(m => m.Keywords)</td>
                <td class="context">@Html.EditorFor(m => m.Keywords)</td>
            </tr>
            <tr>
                <td class="name">@Html.DisplayNameFor(m => m.Description)</td>
                <td class="context">@Html.EditorFor(m => m.Description)</td>
            </tr>
            <tr>
                <td class="name">@Html.DisplayNameFor(m => m.HomeSort)</td>
                <td class="context">@Html.EditorFor(m => m.HomeSort)</td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <input type="submit" value="提交" />
                    <input type="button" value="返回" onclick="history.go(-1);" />
                </td>
            </tr>
        </tbody>
    </table>
}
@section scripts{
    <!-- 配置文件 -->
    <script src="~/Areas/Admin/Scripts/ueditor1_4_3/ueditor.config.js"></script>
    <!-- 编辑器源码文件 -->
    <script src="~/Areas/Admin/Scripts/ueditor1_4_3/ueditor.all.min.js"></script>
    <!-- 实例化编辑器 -->
    <script type="text/javascript">
        var ue = UE.getEditor('container', {
            elementPathEnabled: false,
            wordCount: false
        });
    </script>
    <script type="text/javascript" src="http://cdn.staticfile.org/webuploader/0.1.0/webuploader.min.js"></script>
    <script src="~/Areas/Admin/Scripts/Uploader.js"></script>
    <script type="text/javascript">
        var filename = $("#MainImage").val();
        if ($("#MainImage").val() != "") {
            $("#mainImg").attr("src", "/upload/image/" + filename.substr(0, 8) + "/" + filename).show()
        }
    </script>
}